﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:ThumbGen">
    <Style x:Key="TextBoxUserBaseStyle" TargetType="{x:Type Control}">
        <Setter Property="Foreground" Value="Black"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Width" Value="225"/>
        <Setter Property="Height" Value="25"/>
        <Setter Property="FontSize" Value="12"/>
        <Setter Property="Padding" Value="1"/>
        <Setter Property="Margin" Value="5"/>
        <Setter Property="AllowDrop" Value="true"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    </Style>

    <DropShadowEffect x:Key="BlurEffect" Color="LightGray" ShadowDepth="0" BlurRadius="10"/>
    
    <Style x:Key="GroupBoxStyle" TargetType="{x:Type GroupBox}">
        <Setter Property="HeaderTemplate">
            <Setter.Value>
                <DataTemplate>
                    <TextBlock Text="{Binding}" Foreground="Black" FontWeight="Bold"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="TextBoxUserStyle" BasedOn="{StaticResource TextBoxUserBaseStyle}" TargetType="{x:Type TextBox}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Border x:Name="OuterBorder" BorderBrush="#5AFFFFFF" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4">
                        <Border x:Name="InnerBorder" Background="#FFFFFFFF" BorderBrush="#33000000" BorderThickness="1,1,1,1" CornerRadius="3,3,3,3">
                            <Grid>
                                <Label x:Name="lblPwd" Visibility="Hidden"
                                       Content="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type TextBox}}, Path=Tag}" FontSize="11" VerticalAlignment="Center" Margin="2,0,0,0" Foreground="#828385" Padding="0"/>
                                <ScrollViewer SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" x:Name="PART_ContentHost"/>
                            </Grid>
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Text" Value=""/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Visibility" TargetName="lblPwd" Value="Visible"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="PasswordBoxVistaStyle" BasedOn="{StaticResource TextBoxUserBaseStyle}" TargetType="{x:Type PasswordBox}">
        <Setter Property="local:PasswordBoxAssistant.BindPassword" Value="true"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type PasswordBox}">
                    <Border x:Name="OuterBorder" BorderBrush="#5AFFFFFF" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4">
                        <Border x:Name="InnerBorder" Background="#FFFFFFFF" BorderBrush="#33000000" BorderThickness="1,1,1,1" CornerRadius="3,3,3,3">
                            <Grid>
                                <Label x:Name="lblPwd" Visibility="Hidden" Content="Password" FontSize="11" VerticalAlignment="Center" Margin="2,0,0,0" Foreground="#828385" Padding="0"/>
                                <ScrollViewer SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" x:Name="PART_ContentHost"/>
                            </Grid>
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <!--<Condition Property="IsFocused" Value="False"/>-->
                                <Condition Property="local:PasswordBoxAssistant.BoundPassword" Value=""/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Visibility" TargetName="lblPwd" Value="Visible"/>
                            <!--<Trigger Property="IsFocused" Value="True">
                                <Setter Property="Visibility" TargetName="lblPwd" Value="Hidden"/>
                            </Trigger>-->
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>